cmake_minimum_required(VERSION 3.7)
project(Three.pp)

set(CMAKE_DEBUG_POSTFIX d)

set(THREE_VERSION 0.9)
set(THREE_ROOT ${CMAKE_CURRENT_SOURCE_DIR})

if(WIN32)
    add_definitions(-DNOMINMAX)
	if(${ASSIMP_PATH})
		set(ASSIMP_PREFIX ${ASSIMP_PATH})
	else()
		set(ASSIMP_PREFIX $ENV{ASSIMP_PATH})
	endif(${ASSIMP_PATH})
    if(NOT IS_DIRECTORY ${ASSIMP_PREFIX})
        message(FATAL_ERROR "ASSIMP_PATH variable (CMake or env) must point to a valid directory")
    endif(NOT IS_DIRECTORY ${ASSIMP_PREFIX})
    set(CMAKE_PREFIX_PATH "${ASSIMP_PREFIX};${CMAKE_PREFIX_PATH}")

    if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
		if(${THREEPP_DEST})
			set(THREEPP_DEST ${THREEPP_DEST})
		else()	
			set(THREEPP_DEST $ENV{THREEPP_DEST})
		endif(${THREEPP_DEST})
        if(NOT IS_DIRECTORY ${THREEPP_DEST})
            message(FATAL_ERROR "THREEPP_DEST variable (CMake or env) must point to a valid directory")
        endif(NOT IS_DIRECTORY ${THREEPP_DEST})

        set(CMAKE_INSTALL_PREFIX "${THREEPP_DEST}" CACHE PATH "..." FORCE)
    endif()
endif(WIN32)

add_subdirectory(threepp)
if(NOT ANDROID)
add_subdirectory(examples)
endif(NOT ANDROID)
add_subdirectory(3rdparty/tinyxml2)
